package com.example.hello_world.dataTransport;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.hello_world.R;

public class dataTrasport01 extends AppCompatActivity implements View.OnClickListener {

    private Button Btn_intent,Btn_bundle;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_data_trasport01);
        Btn_intent=findViewById(R.id.intent_data);
        Btn_bundle=findViewById(R.id.bund_data);

        Btn_intent.setOnClickListener(this);
        Btn_bundle.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.intent_data:
                Intent intnet01=new Intent(this,showData.class);
                intnet01.putExtra("string01","intnet传送的数据");
                startActivity(intnet01);
                break;

            case R.id.bund_data:
                Intent intent02=new Intent(this,showBundleData.class);
                String s="这是bundle传送的数据";
                Bundle bundle=new Bundle();
                bundle.putString("sting02",s);
                intent02.putExtra("bun",bundle);
                startActivity(intent02);
                break;
        }
    }
}